<!-- 
	/**
	 * All rights Reserved, Designed By www.youyacao.com <br>
	 * @Description:新闻上传 <br>
	 * @version 蜻蜓Q系统  <br>
	 * @author:成都市一颗优雅草科技有限公司  <br>
	 * 注意：使用我司开源源代码请遵循license文件的协议仅供个人非盈利使用，禁止用于其他的商业用途
	 * 需要商业用途或者定制开发等可访问songshu.youyacao.com  联系QQ:2853810243 422108995 23625059584
	 * 正版系统查询系统 zhengbancha.youyacao.com
	 */
 -->



<template>
	 <view class="content">
		  <view class="release-box">
				<view class="release-box-left"> 
				<input type="text" placeholder="请输入标题" v-model="data.title">
				
				</view>
				<!-- <view class="release-box-right"><image   src="../../static/ImgUpload.svg"></image> <view  style="text-align: center;color: #333;">上传图片</view></view> -->
		  </view>
		  <jinEdit placeholder="请输入内容" @editOk="editOk" uploadFileUrl="https://stqingtingapi.youyacao.com/api/v1/upload" height="100rpx"></jinEdit>
<!-- 		   <view class="release-box-content">
			    <view class="release-box-content-fb">
					
			    
			    </view>
		   </view> -->
<!-- 		   <view class="release-tips">
			    <view class="">
					提示
				</view>
				<view class="release-text">1. 仅可上传具有安全教育意义的视频</view>
				<view class="release-text">2. 上传视频时长需要控制在10分钟以内，大小不可超过100M </view>
				<view class="release-text">3. 如上传其他平台带有水印类视频，务必处理掉片尾平台后缀，否则不予审核通过 </view>
		   </view>
		   -->
		    <view>

		
		
			</view>
			<view class="footer-btn" @click="btn">发布</view>
	 </view>
</template>

<script>
	import jinEdit from '@/components/jin-edit/jin-edit.vue';
		import {getNewsListAdd } from '@/common/api.js'
		export default {
			components: {
			jinEdit
			},
			data() {
				return {
					current: 0,
					data:{
						title:"",
						body:"",
						category_id:"",
					}
				
				};
			},
			onLoad(option) {
				this.data.category_id=option.id
				 console.log(	this.data)
			},
			onShow() {
			// category_id	是	string	分类id
			// title	是	string	新闻标题
			// body	是	string	新闻内容
			// images	是	array	新闻插图
			// videos	是	array	新闻视频
			},
			methods: {
				editOk(res) {
					this.data.body=res.html;
				    console.log(res);
				},
				btn(){
					if(this.data.title==""){
						uni.showToast({
						    title: '请输入标题',
							icon:'none',
						    duration: 2000
						});
						return;
					}
					if(this.data.body==""){
						uni.showToast({
						    title: '请先勾选对号公开发布',
							icon:'none',
						    duration: 2000
						});
						return;
					}
				
						this.getList();
				},
				getList(){
						getNewsListAdd(this.data).then(res=>{
								if(res.code==200){
									uni.showToast({
									    title: res.msg,
										icon:'none',
									    duration: 2000
									});
								}
								uni.reLaunch({
								
								url: '/pages/newsList/index'
								
								});
						})
				
				},
		
			}
		}
</script>

<style>
	page{
		/* background-color: rgba(248, 248, 249, 1); */
	}
	.release-box{
		display: flex;
		background-color: #fff;
		padding-left: 30rpx;
		padding-right: 30rpx;
		padding-top: 52rpx;
	    padding-bottom: 30rpx;
		border-top: 16rpx solid rgba(248, 248, 249, 1);
	}
	.release-box .release-box-left{
		position: relative;
		width: 100%;
		height: 80rpx;
	   background:rgba(95, 123,148,0.06);
		overflow: hidden;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
	}
	.release-box .release-box-left input{
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		padding-left: 30rpx;
		padding-top: 22rpx;
		
	}
	.release-box-right{
		width: 196rpx;
		height: 300rpx;
		/* line-height: 300rpx; */
		background: #F5F7F9;
		border-radius: 0px 0px 0px 0px;
		/* background:#4a99e4; */
		 margin-left: 24rpx;
		 font-size: 26rpx;
		 font-family: PingFang SC-Regular, PingFang SC;
		 font-weight: 400;
		 color: #3680FF;
		 text-align: center;
	}
	.release-box-right image{
		width: 50%;
		height: 50%;
	}
	.release-tips{
		width: 662rpx;
		height: 270rpx;
		padding-top: 16rpx;
		padding-left: 20rpx;
		box-sizing: border-box;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		opacity: 1;
		border: 2rpx dashed #C7C7C7;
		background-color: #fff;
		margin: 0 auto;
	}
	.release-tips .release-text{
		font-size: 20rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #000000;
		margin-top: 20rpx;
	}
	.release-btn{
		margin-top: 30rpx;
	}
	.footer-btn{
		position: fixed;
		bottom: 48rpx;
		left: 50%;
		margin-left: -184rpx;
		width: 368rpx;
		height: 96rpx;
		text-align: center;
		line-height: 96rpx;
		text-align: center;
		background: #4a99e4;
		border-radius: 6rpx 6rpx 6rpx 6rpx;
		opacity: 1;
		color: #fff;
	}
	.release-box-content{
		width: 100%;
		margin: 0 auto;
		height: 300rpx;
		background:#fff;
		box-sizing: border-box;
		padding-left: 40rpx;
		padding-right: 40rpx;
	}
	.release-box-content-fb{
		padding-left: 30rpx;
		padding-right: 30rpx;
		padding-top: 30rpx;
		box-sizing: border-box;
		overflow: hidden;
	
				width: 100%;
				height: 80%;
				margin: 0 auto;
			   background:rgba(95, 123,148,0.06);
	}
	.release-box-content-fb textarea{
			font-size: 30rpx;
	}
</style>